<?php
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
	include '../../connection/connection.php';
	include "../../value/value_kr.php";	
	
	$list=$_SESSION['sort'];
	$str=$_GET['string'];
	$_SESSION['sortn']=$str;
	$flagDesc=$_GET['flagDesc'];
	$search = $_REQUEST['search'];
	
	$winH = $_REQUEST['winH'];
	
	if($flagDesc==1){

		if($list[$str]=="DESC")
			$list[$str]="ASC";
		else
			$list[$str]="DESC";
	}
	
	$sql = "SELECT p.* FROM pc p WHERE p.`name` LIKE '%".$search."%' ";
	$selectPC = mysql_query($sql." ORDER BY ".$str." ".$list[$str], $connection);
	
	$_SESSION['sort']=$list;
	?>
<div style="overflow:scroll;overflow-x: hidden; width:100%; height:<?php echo ($winH-280)."px"?>; background-color: #ffffff">
	        <table cellpadding="0" cellspacing="0" border="0" width="100%" class="tbchung" id="tablebody2">
	            <tbody>
	            <?php 
	            		$i = 0; 
				     		while ($row = mysql_fetch_array($selectPC)){ 
				     			$i++;?>
	            <tr id="idrowpc" onclick="onclickRowPC(this,'<?=$row[ip]?>');">
	            	<td style="width: 5%"><?=$i?></td>
	                <td style="width: 25%"><?=$row[ip]?></td>
	                <td style="width: 30%"><?php if ($row[name]==''){echo "&nbsp;";}else{?> <?=$row[name]?><?php }?></td>
	                <td style="width: 20%"><?php if ($row[total_hardisk]==''){echo "&nbsp;";}else{?> <?=$row[total_hardisk]?><?php }?></td>
	                <td style="width: 20%;border-right: none !important;" class="last"><?php if ($row[used_hardisk]==''){echo "&nbsp;";}else{?> <?=$row[used_hardisk]?><?php }?></td>
	            </tr>
	            <?php 
				     	}
						if ($i>0 and $i<($winH/28)) {
							 	foreach(range(0,($winH/28)-$i) as $real){
							 		?>
							 		<tr>
								 		<td width="5%">&nbsp;</td>
								 		<td width="25%">&nbsp;</td>
								 		<td width="30%">&nbsp;</td>
									 	<td width="20%">&nbsp;</td>
									 	<td class="last" style="width: 20%;border-right: none !important;">&nbsp;</td>
								 	</tr>
							 	<?php }
							}?>
	            </tbody>              
	        </table>
	        </div>
    <?php mysql_close($connection);?>